﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace IKYSWeb.UserControls
{
    public partial class UserControls_CokluSecim : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void ListeyiDoldur(DataSet ds, string sTextField, string sValueField)
        {
            lstCokluSecim.Items.Clear();
            BasePage.ListDoldurFromDS(ds, lstCokluSecim, sTextField, sValueField, BasePage.ListeIlkYazı.Yok);
        }

        public void ListeyiDoldur(DataSet ds, string sTextField, string sValueField, BasePage.ListeSirala enmSort)
        {
            lstCokluSecim.Items.Clear();
            BasePage.ListDoldurFromDS(ds, lstCokluSecim, sTextField, sValueField, BasePage.ListeIlkYazı.Yok, enmSort);
        }

        public void ListeyiDoldurFroMenum(Type enm)
        {
            lstCokluSecim.Items.Clear();
            BasePage.ListDoldurFromENUM(enm, lstCokluSecim, BasePage.ListeIlkYazı.Yok);
        }

        public string strSecilenler()
        {
            return BasePage.ListControlValueToStr(lstCokluSecim);
        }

        public void Clear()
        {
            lstCokluSecim.Items.Clear();
        }
        public bool AllowEmpty
        {
            set { 
                rqvCokluSecim.Enabled = !value;
                lstCokluSecim.AutoPostBack = !value; 
            }
        }

        public void SetVisibility(bool value)
        {
            pnl.Visible = value;
        }
        public void ClearSelection()
        {
            foreach (ListItem item in lstCokluSecim.Items)
            {
                item.Selected = false;
            }
        }
        public Unit Width
        {
            set
            {
                lstCokluSecim.Width = value;
            }
        }

        public virtual ListItemCollection Items
        {
            get
            {
                return lstCokluSecim.Items;
            }
        } 
         
    }
}